package cn.witsky.cdrService.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import cn.witsky.cdrService.util.StringUtil;

@Component
@ConfigurationProperties(prefix = "ftp")
public class FtpConfig {
	private String host;
	private int port;
	private String userName;
	private String passWord;
	private String basePath;
	private String path;

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassWord() {
		return passWord;
	}

	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	public String getBasePath() {
		return basePath;
	}

	public void setBasePath(String basePath) {
		this.basePath = basePath;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}


	public boolean validate() {
		boolean isValid = true;
		if (isValid) {
			isValid = !StringUtil.isEmpty(this.host);
		}
		if (isValid) {
			isValid = !StringUtil.isEmpty(this.port);
		}
		if (isValid) {
			isValid = !StringUtil.isEmpty(this.userName);
		}
		if (isValid) {
			isValid = !StringUtil.isEmpty(this.passWord);
		}
		
		return isValid;
	}

}
